package store

import (
	"gorm.io/gorm"
	"guard/internal/app/user/models"
	"guard/internal/tool"
)

type UserStore interface {

	// SelUser 查询用户
	SelUser(username string) (id int, userName, password, nickname, picture, userScopeTag string, enable bool, err error)

	UserAdminStore
}

type userStoreImpl struct {
	db *gorm.DB
}

func NewUserStore(d *gorm.DB) UserStore {
	return &userStoreImpl{
		db: d,
	}
}

// UserAdminStore 用户后台管理
type UserAdminStore interface {
	SelUserPage(current, size int) *tool.Paginator
	SelUserQuery(id int, username string) (*models.User, error)
	SaveOrUpdateUser(user models.User) error
	DeleteUser(username string) error
}
